package com.baidu.automata.core.type;

import org.apache.commons.lang3.StringUtils;
import org.dom4j.Element;
import org.w3c.dom.Node;

public class FloatField extends BasicDataField<Float> {
	private Float value;

	public FloatField() {
		super();
	}

	public FloatField(String id) {
		super(id);
	}

	@Override
	public Float getValue() {
		return this.value;
	}

	@Override
	public void setValue(Float value) {
		this.value = value;
	}

	@Override
	public void deserialize(Element e) throws Exception {
		this.id = e.attributeValue("id");
		String text = e.getTextTrim();
		this.value = StringUtils.isBlank(text) ? null : Float.parseFloat(text);
	}

	@Override
	public Node serialize() throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

}
